/*
 * Copyright 2011 Mark Davidson.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package org.dctmcommons;

import java.io.Serializable;

import org.dctmcommons.impl.AttribHelper;
import org.dctmcommons.impl.MethodBuilder;
import org.dctmcommons.impl.ObjectHelper;
import org.dctmcommons.impl.PathBuilder;
import org.dctmcommons.impl.QueryHelper;
import org.dctmcommons.impl.SecurityHelper;
import org.dctmcommons.impl.SessionHelper;
import org.dctmcommons.impl.StringHelper;
import org.dctmcommons.impl.TeardownBuilder;
import org.dctmcommons.impl.TypeHelper;
import org.dctmcommons.impl.VirtualDocHelper;
import org.dctmcommons.impl.WorkflowHelper;

/**
 * Facade for accessing helper objects.
 * @author Mark Davidson
 */
public class DctmCommons implements Serializable {

	/** Serial id. */
	private static final long serialVersionUID = 200096581265676478L;

	/** The attrib helper. */
	public final IAttribHelper attrib = AttribHelper.getInstance();
	
	/** The object helper. */
	public final IObjectHelper object = ObjectHelper.getInstance();
	
	/** The query helper. */
	public final IQueryHelper query = QueryHelper.getInstance();
	
	/** The security helper. */
	public final ISecurityHelper security = SecurityHelper.getInstance();
	
	/** The session helper. */
	public final ISessionHelper session = SessionHelper.getInstance();
	
	/** The type helper. */
	public final ITypeHelper type = TypeHelper.getInstance();
	
	/** The lifecycle helper. */
	//public final ILifecycleHelper lifecycle = LifecycleHelper.getInstance();
	
	/** The workflow helper. */
	public final IWorkflowHelper workflow = WorkflowHelper.getInstance();
	
	/** The virtual document helper. */
	public final IVirtualDocHelper virtual = VirtualDocHelper.getInstance();
	
	/** The string helper. */
	public final IStringHelper string = StringHelper.getInstance();
	
    /**
     * Default constructor.
     */
	protected DctmCommons() {}
	
    /**
     * Factory method.
     * @return The DctmCommons instance.
     */
    public static DctmCommons getInstance() {
        return new DctmCommons();
    }
    
    /**
     * Instantiates a {@link PathBuilder}.
     * @param basePath The base path
     * @return A new path builder instance
     */
    public IPathBuilder buildPathFrom(final String basePath) {
    	return PathBuilder.from(basePath);
    }
    
    /**
     * Instantiates a {@link TeardownBuilder}.
     * @param basePath The base path
     * @return A new teardown builder instance
     */
    public ITeardownBuilder teardownFrom(final String basePath) {
    	return TeardownBuilder.from(basePath);
    }
    
    /**
     * Instantiates a {@link MethodBuilder}.
     * @param methodName The method name
     * @return A new method builder instance
     */
    public IMethodBuilder withMethod(final String methodName) {
    	return MethodBuilder.withMethod(methodName);
    }
}
